package com.lfm.improve_;

import java.util.ArrayList;

@SuppressWarnings({"all"})
public class Generic02 {
    public static void main(String[] args) {
        ArrayList<Dog> list = new ArrayList<Dog>();
        list.add(new Dog("Brien", 2));
        list.add(new Dog("Kitty", 5));
        list.add(new Dog("Bruce", 6));

        for (Dog dog : list) {
            System.out.println(dog.getName() + "-" + dog.getAge());
        }


    }
}
class Dog {
    private String name;
    private int age;


    public Dog(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public int getAge() {
        return age;
    }



}

class Cat {

    private String name;
    private int age;


    public Cat(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public int getAge() {
        return age;
    }
}
